package com.w2cx.selenium.testCase;

import com.w2cx.selenium.base.DriverBase;
import com.w2cx.selenium.business.*;
import org.testng.annotations.*;


public class CaseBase {

    //page定义
    public static DriverBase driver = null;
    LoginProcess loginPro;
    InformationManageProcess informationManagePro;
    InformationContentProcess icp;
    MarkCategoryManageProcess mcmp;
    MarkLibraryManageProcess mlmp;
    SensitiveWordsManageProcess swmp;
    POI_CateManageProcess pcmp;
    PoiLibrManaProcess plmp;
    DestinationManageProcess dmp;
    InformationReviewProcess irp;
    VideoReviewProcess vrp;
    CommentManageProcess cmp;
    ConfigOperatePositionProcess copp;
    OpreatPositionManageProcess opmp;
    ColdBootManageProcess cbmp;
    TalentAuthMangeProcess tamp;


    @BeforeClass
    @Parameters({"username","password","code","driverName"})
    public void setUp(String username,String password,String code,String driverName){

        //生成浏览器driver
        driver = new DriverBase(driverName);

        //初始化页面
        loginPro = new LoginProcess(driver);
        informationManagePro = new InformationManageProcess(driver);
        icp = new InformationContentProcess(driver);
        mcmp = new MarkCategoryManageProcess(driver);
        mlmp = new MarkLibraryManageProcess(driver);
        swmp = new SensitiveWordsManageProcess(driver);
        pcmp = new POI_CateManageProcess(driver);
        plmp = new PoiLibrManaProcess(driver);
        dmp = new DestinationManageProcess(driver);
        irp = new InformationReviewProcess(driver);
        vrp = new VideoReviewProcess(driver);
        cmp = new CommentManageProcess(driver);
        copp = new ConfigOperatePositionProcess(driver);
        opmp = new OpreatPositionManageProcess(driver);
        cbmp = new ColdBootManageProcess(driver);
        tamp = new TalentAuthMangeProcess(driver);



        //登录
        loginPro.openHomePage("http://172.16.10.68:5050/#/login");
        loginPro.login(username,password,code);
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        /*cookieHandle = new CookieHandle(driver);
        informationManagePro.gotoInformationManage();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //设置cookie
        cookieHandle.setCookie();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/
       /* informationManagePro.gotoInformationManage();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/

    }


    @AfterClass
    public void tearDown(){

        driver.stopDriver();
    }


  /*  @AfterSuite
    public void afterSuite(){
        SendEmail1.sendToEmail();
    }
*/

}
